<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
      if(isset($_POST['sb'])){
         $chin=$_POST['chin'];
         $math=$_POST['math'];
         if($chin=='' || !is_numeric($chin) || $chin<0 || $chin>100){
             echo '语文成绩输入不规范';
         }
         elseif($math=='' || !is_numeric($math) || $math<0 ||$math>100){
             echo '数学成绩输入不规范';
         }else{
             $avg=($chin + $math)/2; // 求平均值
             echo "您的成绩平均分为 {$avg} <br>";
             if($avg>=90){
                 echo 'A';
             }
             elseif($avg>=80){
                 echo 'B';
             }
             elseif($avg>=70){
                 echo 'C';
             }
             elseif($avg>=60){
                 echo 'D';
             }
             else{
                 echo 'E';
             }
         }
      }
    ?>
    <form action="" method="POST">
        语文：<input type="text" name="chin"> <br>
        数学：<input type="text" name="math"><br>
        <input type="submit" value="判断成绩" name="sb">
    </form>
</body>
</html>